package com.bjesc_b2c.app.appraiset.mvp.view.activity;

import android.os.Bundle;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;

import com.bjesc_b2c.app.appraiset.R;
import com.bjesc_b2c.app.appraiset.base.BaseFragmentActivity;
import com.bjesc_b2c.app.appraiset.mvp.view.fragment.CarChassisFragment;
import com.bjesc_b2c.app.appraiset.mvp.view.fragment.CarDetailsFragment;
import com.bjesc_b2c.app.appraiset.mvp.view.fragment.CarExteriorFragment;
import com.bjesc_b2c.app.appraiset.mvp.view.fragment.CarInteriorFragment;
import com.bjesc_b2c.app.appraiset.mvp.view.fragment.CarformalitiesFragment;

import butterknife.ButterKnife;
import butterknife.InjectView;
import butterknife.OnClick;

/**
 * Created by yidong on 2017/5/18.
 */

public class CarDelailsActivity extends BaseFragmentActivity implements RadioGroup.OnCheckedChangeListener {

    @InjectView(R.id.rb_car_overall)
    RadioButton carOverallRb;
    @InjectView(R.id.rb_car_exterior)
    RadioButton carExteriorRb;
    @InjectView(R.id.rb_car_interior)
    RadioButton carInteriorRb;
    @InjectView(R.id.rb_car_chassis)
    RadioButton carChassisRb;
    @InjectView(R.id.rb_car_formalities)
    RadioButton carFormalitiesRb;
    @InjectView(R.id.rg_group)
    RadioGroup indexRg;
    @InjectView(R.id.tv_title)
    TextView titleTV;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_car_dateils);
        ButterKnife.inject(this);
        initViews();
    }

    private void initViews() {
        indexRg.setOnCheckedChangeListener(this);
        carOverallRb.setChecked(true);
    }

    @OnClick(R.id.rl_return)
    public void onClick() {
        finish();

    }

    @Override
    public void onCheckedChanged(RadioGroup group, int checkedId) {
        switch (checkedId) {

            case R.id.rb_car_overall:
                switchContent(CarDetailsFragment.class, R.id.f2_content);
                break;
            case R.id.rb_car_exterior:
                switchContent(CarExteriorFragment.class, R.id.f2_content);
                break;
            case R.id.rb_car_interior:
                switchContent(CarInteriorFragment.class, R.id.f2_content);
                break;
            case R.id.rb_car_chassis:
                switchContent(CarChassisFragment.class, R.id.f2_content);
                break;
            case R.id.rb_car_formalities:
                switchContent(CarformalitiesFragment.class, R.id.f2_content);
                break;

        }
    }
}